import request from '@/utils/request/request';
import requestForFile from '@/utils/request/requestForFile';

// 获得暂估列表,分页
export function getQueryPage(data: any) {
  return request.post('/api/procurement/pay/assessment-info/page', data);
}

// 新建暂估信息
export function addQueryPage(data: any) {
  return request.post('/api/procurement/pay/assessment-info', data);
}
// 导出到Excel
export function exportDataToExcel(params: any) {
  // 文件导出接口要用专门的requestForFile，且要求responseType为blob才行
  return requestForFile.get('/api/procurement/pay/assessment-info/export', {
    params,
    responseType: 'blob',
  });
}
// 编辑暂估信息
export function editQueryPage(data: any) {
  return request.put('/api/procurement/pay/assessment-info', data);
}
// 通过id删除暂估信息表信息
export function deleteQueryPage(id: string) {
  return request.delete('/api/procurement/pay/assessment-info/delete', {
    params: { id },
  });
}
// 导入Excel
export function importExcelToData(data: FormData) {
  return request.post('/api/procurement/pay/assessment-info/import', data, {
    headers: {
      'Content-Type': 'application/form-data',
    },
  });
}
// 下载模板
export function downloadTemplate() {
  return requestForFile.get(
    `/api/procurement/pay/assessment-info/download/template`,
    {
      responseType: 'blob',
    }
  );
}
